#include <QApplication>
#include <QWidget>
#include <QLabel>
#include <iostream>

int main(int argc, char *argv[])
{
    std::cout << "=== MINIMAL TEST PROGRAM ===" << std::endl;
    std::cout << "Starting minimal Qt test..." << std::endl;
    
    try {
        std::cout << "Creating QApplication..." << std::endl;
        QApplication app(argc, argv);
        std::cout << "QApplication created successfully" << std::endl;
        
        std::cout << "Creating simple widget..." << std::endl;
        QWidget window;
        window.setWindowTitle("Minimal Test");
        window.resize(300, 200);
        
        QLabel *label = new QLabel("Test Label", &window);
        label->move(50, 50);
        
        std::cout << "Showing widget..." << std::endl;
        window.show();
        std::cout << "Widget shown successfully" << std::endl;
        
        std::cout << "Starting event loop..." << std::endl;
        return app.exec();
        
    } catch (const std::exception& e) {
        std::cout << "Exception: " << e.what() << std::endl;
        return -1;
    } catch (...) {
        std::cout << "Unknown exception" << std::endl;
        return -2;
    }
}